{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>编辑店铺</h5>
                </div>
                <div class="ibox-content layui-form">
                    <div class="layui-row layui-col-space10 layui-form-item ">

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">店铺名称：</label>
                            <div class="layui-input-block">
                                <input type="text" name="store_name" lay-verify="required" class="layui-input" placeholder="店铺名称" value="{$store.store_name}">
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">联系方式：</label>
                            <div class="layui-input-block">
                                <input type="text" name="store_phone" lay-verify="required" class="layui-input" placeholder="联系方式" value="{$store.store_phone}">
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">店主：</label>
                            <div class="layui-input-block">
                                <select name="store_user_id" xm-select="select1" lay-verify="required" xm-select-search="" xm-select-radio="" xm-select-search-type="dl">
                                    {foreach name="user" item="v"}
                                    <option value="{$v.user_id}" {$v.user_id == $store.store_user_id ? 'selected' : ''}>{$v.user_username}---{$v.user_real_name}---{$v.user_phone}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">实际经营者：</label>
                            <div class="layui-input-block">
                                <select name="store_real_user_id" xm-select="select2" lay-verify="required" xm-select-search="" xm-select-radio="" xm-select-search-type="dl">
                                    {foreach name="user" item="v"}
                                    <option value="{$v.user_id}" {$v.user_id == $store.store_real_user_id ? 'selected' : ''}>{$v.user_username}---{$v.user_real_name}---{$v.user_phone}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">所在省：</label>
                            <div class="layui-input-block">
                                <select name="store_sheng" lay-search="" id="province"  lay-filter="province">
                                    <option value="">---- 请选择省 ----</option>
                                    {foreach name="province" item="vo"}
                                    <option value="{$vo.district_id}" {$vo.district_id == $store.store_sheng ? 'selected' : ''}>{$vo.district}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">所在市：</label>
                            <div class="layui-input-block">
                                <select name="store_shi" lay-search=""  id="city"  lay-filter="city">
                                    {foreach name='city' item='vo1'}
                                    <option value="{$vo1.district_id}" {$vo1.district_id == $store.store_shi ? 'selected' : ''}>{$vo1.district}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">所在区：</label>
                            <div class="layui-input-block">
                                <select name="store_qu" lay-search=""  id="district"  lay-filter="district">
                                    {foreach name='district' item='vo2'}
                                    <option value="{$vo2.district_id}" {$vo2.district_id == $store.store_qu ? 'selected' : ''}>{$vo2.district}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">店铺地址:</label>
                            <div class="layui-input-block">
                                <div id="l-map" style="width:100%;height:500px;margin-bottom:20px;"></div>
                                <div id="searchResultPanel" style="border:1px solid #C0C0C0;width:150px;height:auto; display:none;"></div>
                                <div class="layui-inline" style="position: absolute;z-index: 10000;top:20px;right:0px;">
                                    <label class="layui-form-label">搜索</label>
                                    <div class="layui-input-inline">
                                        <input id='suggestId' type="text" class="layui-input" placeholder="请输入关键字">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">地址</label>
                                    <div class="layui-input-inline">
                                        <input type="text" id="address_b" name="store_address" class="layui-input" placeholder="地址"  style="height:30px;width:500px" value="{$store.store_address}">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">经度</label>
                                    <div class="layui-input-inline">
                                        <input type="text" id="lon_b" name="store_lon" class="layui-input" placeholder="经度" readonly value="{$store.store_lon}">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">纬度</label>
                                    <div class="layui-input-inline">
                                        <input type="text" id="lat_b" name="store_lat" class="layui-input" placeholder="纬度" readonly value="{$store.store_lat}">
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">其它信息：</label>
                            <div class="layui-input-block">
                                <textarea name="store_remark" lay-verify="required" placeholder="其它信息" class="layui-textarea">{$store.store_remark}</textarea>
                            </div>
                        </div>

                        <input type="hidden" name="store_id" value="{$store_id}">

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit="" lay-filter="component-form-element">保存
                                </button>
                                <button class="layui-btn layui-btn-primary" onclick="history.go(-1)">关闭</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=KQnMmWiFFe98BhjfhZsM7LlCZ38qlhAv"></script><!--百度-->
<!--定位地址-->
<script type="text/javascript">
    wk.bmap();
</script>

<script>
    layui.use(['form','upload','layedit','laydate'], function() {
        var form = layui.form;

        form.on('submit(component-form-element)', function (data) {
            $('.layui-btn').addClass('layui-disabled').attr('disabled','disabled');
            $.ajax({
                url:"{:url('storeEdit')}",
                type:'post',
                dataType:'json',
                data:data.field,
                success:function(res){
                    if (res.code == 200) {
                        wk.success(res.msg,"{:url('Store/index')}")
                    } else {
                        wk.error(res.msg,'','$(".layui-btn").removeClass(\'layui-disabled\').removeAttr(\'disabled\');');
                    }
                }
            });
        });
    });
</script>

</body>
</html>
